package com.react.bluetoothprinter;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;

/**
 * Created by Administrator on 2017/9/6.
 */

public class Bitmap {

    public static android.graphics.Bitmap bitmaptest() {

        String itemName ="你好打印机";

        int w = 640;
        int h = 640;

        //Bitmap qr = BarcodeUtils.creatBarcode(BaseApplication.getContext(), "16887498665498", w / 3, h / 4, true);
        android.graphics.Bitmap mbmpTest = android.graphics.Bitmap.createBitmap(w, h, android.graphics.Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(mbmpTest);
        canvas.drawColor(Color.WHITE);

        Paint paint = new Paint();
        paint.setColor(Color.BLACK);
        paint.setAntiAlias(true);
        //左对齐
        paint.setTextAlign(Paint.Align.CENTER);
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
        paint.setTextSize(50);
        paint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD));//粗体


        canvas.drawText(itemName, 45, 8, paint);//品名



        return mbmpTest;
    }
}
